<template>
    <div class="top">
        <div class="left">
            <span class="lbtn" @click="goHome">首页</span>
        </div>
        <div class="center">
            <div class="title">商城用户画像 </div>
        </div>
        <div class="right">
            <div class="rbtn"><span>统计报告</span></div>
            <span class="time">当前时间：{{ time }}</span>
        </div>
    </div>
</template>

<script setup lang="ts">
import { onMounted, ref, onBeforeUnmount } from 'vue';
import moment from 'moment'
let timmer = ref<number>(0)
const time = ref(moment().format('YYYY-MM-DD HH:mm:ss'))
// 页面一渲染 就切换到全屏
onMounted(() => {
    document.documentElement.requestFullscreen()
    timmer.value = setInterval(() => {
        time.value = moment().format('YYYY-MM-DD HH:mm:ss')
    }, 1000)
})
const goHome = () => {
    window.location.href = "/"
}

onBeforeUnmount(() => {
    clearInterval(timmer.value)
})
</script>

<style lang="scss" scoped>
.top {
    text-align: center;
    line-height: 40px;
    display: flex;
    width: 100%;
    height: 40px;

    .left {
        flex: 1;
        background: url(../../images/dataScreen-header-left-bg.png) no-repeat;
        background-size: cover;

        .lbtn {
            float: right;
            width: 150px;
            height: 40px;
            background: url(../../images/dataScreen-header-btn-bg-l.png) no-repeat;
            background-size: 100% 100%;
            color: #29fcff;
            font-size: 20px;
        }
    }

    .center {
        flex: 2;

        .title {
            height: 74px;
            width: 100%;
            background: url(../../images/dataScreen-header-center-bg.png) no-repeat;
            background-size: 100% 100%;
            color: #29fcff;
            line-height: 74px;
            font-size: 32px;
        }
    }

    .right {
        flex: 1;
        background: url(../../images/dataScreen-header-right-bg.png);
        color: #29fcff;
        display: flex;
        justify-content: space-between;

        .time {
            margin-right: 10px;
        }

        .rbtn {
            float: left;
            width: 150px;
            height: 40px;
            background: url(../../images/dataScreen-header-btn-bg-r.png) no-repeat;
            background-size: 100% 100%;
            font-size: 20px;
        }
    }

}
</style>